package tasktracker.abstraction;

public class TaskStatus {

	public final static int NONE = 0;
	public final static int PENDING = 1;
	public final static int RUNNING = 2;
	public final static int COMPLETED = 4;
	public final static int CANCELED = 12;
	public final static int ERROR = 20;
	public final static int LOST_TRACK = 32;

	public static boolean isCommitted(int status) {
		return status == NONE;
	}

	public static boolean isPending(int status) {
		return status == PENDING;
	}

	public static boolean isRunning(int status) {
		return status == RUNNING;
	}

	public static boolean isCompletedSuccessfully(int status) {
		return status == COMPLETED;
	}

	public static boolean isCompletedAnyway(int status) {
		return (status & COMPLETED) != 0;
	}

	public static boolean isCanceled(int status) {
		return status == CANCELED;
	}

	public static boolean isError(int status) {
		return status == ERROR;
	}

	public static boolean isLostTrack(int status) {
		return status == LOST_TRACK;
	}

	public static boolean isMeaningful(int status) {
		return status == NONE || status == PENDING || status == RUNNING || status == COMPLETED
				|| status == CANCELED || status == ERROR || status == LOST_TRACK;
	}
}
